package com.iss.view.view;

import com.iss.model.Room;

import java.util.List;

public class RoomTable implements ConsoleTable<Room> {
    @Override
    public void printHeader() {
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append("房间编号\t");
        stringBuilder.append("房间状态\t");
        stringBuilder.append("房间类型\t");
        stringBuilder.append("房间价格t");
        System.out.println(stringBuilder.toString());
    }

    @Override
    public void toTable(List<Room> list) {

        for (Room room : list) {
            printRow(room);
        }
    }

    private void printRow(Room room) {

        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append("|" + room.getRoomNO() + "|\t");
        stringBuilder.append("|" + Room.ROOM_STATUS.get(room.getStatus()) + "|\t");
        stringBuilder.append("|" + room.getRoomType() + "|\t");
        stringBuilder.append("|" + room.getPrice() + "|\t");

        System.out.println(stringBuilder.toString());
    }
}
